/*
题目链接:https://leetcode.cn/problems/number-of-equivalent-domino-pairs/description/?envType=daily-question&envId=2025-05-04
*/
//题解代码:
class Solution {
public:
    int numEquivDominoPairs(vector<vector<int>>& dominoes) {
        int ans = 0;
        map<int,int> cnt;
        for(auto& arr : dominoes){
            if(arr[0] > arr[1]) swap(arr[0],arr[1]);
            ans += cnt[arr[0]<<4 | arr[1]];
            cnt[arr[0]<<4 | arr[1]]++;
        }
        return ans;
    }
};
